package activity;

import activity.domain.Activity;

import javax.xml.ws.Endpoint;
import java.util.List;

/**
 * @author 罗俊华
 * @date 2021/5/26 - 8:22 上午
 */
public class RecursiveActivitySelect {


    public static void select(int[] startTime, int[] finishTime, int k, int n, List<Activity> result) {

        int m = k + 1;
        while (m < n && startTime[m] < finishTime[k]) {
            m++;
        }

        if (m < n) {
            result.add(new Activity(startTime[m], finishTime[m]));
            select(startTime, finishTime, m, n, result);
        }

    }
}
